package de.breitbeil.samsyncro.lib.test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import de.breitbeil.samsyncro.lib.Application;
import de.breitbeil.samsyncro.lib.connection.MObexConnection;
import de.breitbeil.samsyncro.lib.domain.fs.SFile;
import de.breitbeil.samsyncro.lib.domain.fs.SFolder;
import de.breitbeil.samsyncro.lib.domain.pim.SPimStorage;
import de.breitbeil.samsyncro.lib.domain.pim.SVCard;


public class BTSync {
    
    public static void main(String[] args) throws Exception {
        
        String[] adress = new String[]{"--address", "444E1A192BCF:3"};
        String[] cmd;
        
        cmd = new String[]{"--scan"};
//        cmd = new String[]{"--help"};
        cmd = new String[]{"--clist"};
        
        ArrayList<String> cmds = new ArrayList<String>();
        cmds.addAll(Arrays.asList(cmd));
        cmds.addAll(Arrays.asList(adress));
        
        
        Application.main(cmds.toArray(new String[0]));
        
        
//        String btAdress = "444E1A192BCF";
//
//        MObexConnection ob = new MObexConnection();
//        
//        ob.openConnection(btAdress, 3);
//        Thread.sleep(100);
//        
//        /*ArrayList<SFolder> folders = ob.getFolderListing("/Images/My photos");
//        printList(folders);
//        Thread.sleep(100);
//        
//        ob.getFolderListing("/Images/My photos");
//        Thread.sleep(100);
//        
//        ArrayList<SFile> files = ob.getFileListing("/Images/My photos");
//        printList(files);
//        Thread.sleep(100);*/
// 
//        
//        SPimStorage storage = ob.getContactsCount();
//        System.out.println(storage);
//        Thread.sleep(100);
//        
//        
//        List<SVCard> vcards = ob.getContacts();
//        printList(vcards);
//        Thread.sleep(100);
//        
//        
//        /*
//        SVCard update = new SVCard();
//        update.setId(25);
//        update.setVcard("BEGIN:VCARD\r\nVERSION:2.1\r\nFN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Test=2014=20208\r\nN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:208;Test=2014;;;\r\nTEL;HOME;CELL:208\r\nNOTE;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Bearbeitet=203\r\nEND:VCARD");
//        //update.setVcard("BEGIN:VCARD\r\nVERSION:2.1\r\nFN:Test 8\r\nN:nachname;Test;;;\r\nTEL;HOME;CELL:208\r\nEND:VCARD");
//        ob.updateContact(update);
//        Thread.sleep(100);
//        */
//        
//        /*SVCard create = new SVCard();
//        //create.setId(38);
//        create.setVcard("BEGIN:VCARD\r\nVERSION:2.1\r\nFN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Tesst=2014=20208\r\nN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:208;Test=2014;;;\r\nTEL;HOME;CELL:200\r\nNOTE;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Neu=202a\r\nEND:VCARD");
//        //create.setVcard("BEGIN:VCARD\r\nVERSION:2.1\r\nFN:Test 8\r\nN:nachname;Test;;");
//        int id = ob.createContact(create);
//        System.out.println(id);
//        Thread.sleep(100);*/
//        
//        
//        /*
//        ob.deleteContact(25);
//        Thread.sleep(100);*/
//        
//        ob.closeConnection();
    }
    
    public static void printList(List l) {
        for(Object o: l) {
            System.out.println(o.toString());
        }
    }
}
